package cn.edu.xmu.oomall.order.microservice;

import cn.edu.xmu.oomall.core.config.OpenFeignConfig;
import cn.edu.xmu.oomall.order.microservice.vo.*;
import cn.edu.xmu.privilegegateway.annotation.aop.LoginUser;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "customer-service", configuration = OpenFeignConfig.class)
public interface CustomerService {

    /** 查看用户自己的信息 */
    @GetMapping("/self")
    InternalReturnObject<CustomerVo> selectSelf();

    @GetMapping("internal/coupon/{id}")
    InternalReturnObject<CouponRetVoForPayment> getCouponById(@PathVariable Long id);

    /**
     * 使用优惠券
     */
    @PutMapping("internal/coupon/{id}")
    InternalReturnObject useCoupon(@PathVariable Long id);

    /**
     * 退还优惠券
     */
    @PutMapping("internal/coupon/{id}/refund")
    InternalReturnObject refundCoupon(@PathVariable Long id);

    /**
     * 使用积点
     */
    @PutMapping("internal/customer/{id}/point")
    InternalReturnObject<PointUseRetVo> usePoint(@PathVariable Long id, @RequestParam Long point);

    /**
     * 返还积点
     */
    @PutMapping("internal/customer/{id}/point/refund")
    InternalReturnObject refundPoint(@PathVariable Long id, @RequestParam Long point);

    @GetMapping("internal/customer/{id}")
    InternalReturnObject<SimpleCustomerRetVo> getCustomerById(@PathVariable Long id);
}
